package com.ts.api.module.api.entity.vo;

import com.gitee.apanlh.util.base.CollUtils;
import com.ts.api.module.api.entity.ApiProtocol;
import com.ts.api.module.match.plan.internal.distribute.model.PlanDistributeField;
import com.ts.api.module.match.plan.internal.distribute.model.PlanDistributePhoneMd5Field;
import lombok.Data;

import java.math.BigDecimal;
import java.util.List;

/**
 *  返回撞库结果-MD5模式实体
 *
 *  @author Pan
 */
@Data
public class RespV3ApiDataExchangeVO {

    /** 公司Logo地址 */
    private String companyLogo;
    /** 公司名称 */
    private String companyName;
    /** 产品名称 */
    private String productName;
    /** 价格 */
    private BigDecimal price;
    /** 协议集合 */
    private List<ApiProtocol> protocolList;

    public RespV3ApiDataExchangeVO() {
        super();
    }

    /**
     *  构造对象
     *  <br>自定义添加隐私协议对象
     *
     *  @return RespV3ApiDataExchangeVO
     */

    public static RespV3ApiDataExchangeVO of(PlanDistributeField planDistributeField) {
        RespV3ApiDataExchangeVO respV3ApiDataExchangeVO = new RespV3ApiDataExchangeVO();
        PlanDistributePhoneMd5Field phoneMd5Field = planDistributeField.getPhoneMd5Field();

        respV3ApiDataExchangeVO.setCompanyName(phoneMd5Field.getProductName());
        respV3ApiDataExchangeVO.setCompanyLogo(phoneMd5Field.getLogoPath());
        respV3ApiDataExchangeVO.setProductName(phoneMd5Field.getDisplayName());
        respV3ApiDataExchangeVO.setPrice(phoneMd5Field.getPrice());

        //  隐私协议对象
        ApiProtocol userProtocolVO = new ApiProtocol();
        userProtocolVO.setProtocolName("《个人信息授权协议》");
        userProtocolVO.setProtocolUrl("https://axh.rongyiudai.com/h5ViewProtocol?uniqueCode=1fc1379861b34ef0898d7864c33b18e2");
        respV3ApiDataExchangeVO.setProtocolList(CollUtils.newArrayList(userProtocolVO));
        return respV3ApiDataExchangeVO;
    }
}
